/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import data.DataProvider;
import java.sql.SQLException;
import java.util.Date;
import org.json.JSONException;
import org.json.JSONObject;

/**
 *
 * @author bertram
 */
public class Artist {
    private String firstName = "";
    private String lastName ="";
    private int artistID;
    private int reginID = 0;
    private String birthDate;
    private String deathDate;
    public Artist()
    {
        try{
            this.artistID = DataProvider.getInstance().getNextArtist();

        }
        catch(SQLException sqx)
        {
           System.out.println("kunne ikke hente næste kunstner id");
        }
    }

    public Artist(int artistID) {
        this.artistID = artistID;
    }
    

    public String getName() {
        return firstName + " " + lastName;
    }

    public void setFirstName(String name) {
        this.firstName = name;
    }

    

    public int getArtistID() {
        return artistID;
    }

    public void setArtistID(int artistID) {
        this.artistID = artistID;
    }

    public int getReginID() {
        return reginID;
    }

    public void setReginID(int reginID) {
        this.reginID = reginID;
    }

    public String getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(String birthDate) {
        this.birthDate = birthDate;
    }

    public String getDeathDate() {
        return deathDate;
    }

    public void setDeathDate(String deathDate) {
        this.deathDate = deathDate;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public JSONObject toJSON() throws JSONException
    {
        JSONObject jsonArtist = new JSONObject();
        jsonArtist.put("kunstner-id", artistID);
        jsonArtist.put("navn", getName());
        jsonArtist.put("født", birthDate);
        jsonArtist.put("død", deathDate);
        return jsonArtist;
    }

    public String getFirstName() {
        return firstName;
    }

    

    

}
